package game

import utile.*

class GameCenter : AbstractCenter() {
    override fun login() {
        showSurfaceTable()
        var USER_name:String;
        var USER_password:String
        var LOGIN_TIMES:Int=3
        while(LOGIN_TIMES>0){
            showLoginTable()
            "请输入账号:".show()
             USER_name= getDATA()
            "请输入密码:".show()
             USER_password= getDATA()
            //"".showWithEnter()
            if(Server.checkUserIsTRUE(USER_name,USER_password))
            {
                "登录成功".showWithEnter()
                break
            }
            else{
                "登录失败".showWithEnter()
                LOGIN_TIMES--
                if(LOGIN_TIMES>0){
                "剩下登录次数$LOGIN_TIMES".showWithEnter()}
                if(LOGIN_TIMES==0){
                    "超过三次输入，请寻求管理员解决".showWithEnter()
                }
            }
        }
    }

    override fun chooseGame() {
        showALLlist(DEFAULT_GAMELIST)
        val gameEnter=getGameChoose()
    }
}